<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<!--公共JS开始-->
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--公共JS结束-->
<!--数据列表插件开始-->
<link href="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.ui.position.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.js"></script>
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Css/etgrid.css">
<script src="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Js/etgrid.js"></script>
<script language="javascript" type="text/javascript" src="__PUBLIC__/Plugins/Datepicker/WdatePicker.js"></script>
<!--数据列表插件结束-->
<style type="text/css">
	body {
		overflow:hidden;
	}
	.table_box {
	}
	.exportBtn{
		background:#339900;
		padding:3px 5px;
		color:#FFFFFF;
		border:0px;
		float:right;
		cursor:pointer;
		margin-right:20px;
	}
	.w300{
		width:300px;
	}
	.w200{
		width:200px;
	}
</style>
</head>

<body>
	<div class="page_header">
		<form method="post" action="{:U('Product/drinkList')}" class="searchForm">
			<div class="search_box">
				<select name="userid" id="userid" class="form_ele">
					<option value="">请选择快递员</option>
					<volist name="user" id="v">
						<option value="{$v.id}">{$v.realname}</option>
					</volist>
				</select>
				<select name="drinkid" id="drinkid" class="form_ele w200">
					<option value="">请选择库存商品</option>
					<volist name="drink" id="v">
						<option value="{$v.id}">{$v.title}</option>
					</volist>
				</select>
				<input type="text" name="startTime" id="startTime" class="form_ele" placeholder="请选择领取开始时间"
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{$m.startTime}">
				-
				<input type="text" name="endTime" id="endTime" class="form_ele" placeholder="请选择领取结束时间" 
					onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{$m.endTime}">
				<span id="doSearch" class="doSearch">
					<i class="icon-search"></i> 搜索
				</span>
				<span id="doRest" class="doSearch">重置</span>
				<span class="exportBtn">导出领取记录</span>
			</div>
		</form>
	</div>
	<div class="table_box">
	</div>
</body>
<script type="text/javascript">
	var listConfig = {
			gridId : 'memberList',
			blockBox : '.table_box',
			blockBoxHeight : 'window',
			jsonUrl : '__URL__/drinkList',
			where : '',
	 		getWhere : function(){
	 			var where          = {};
				where['drinkid']   = $('#drinkid').val();
				where['userid']    = $('#userid').val();
				where['startTime'] = $('#startTime').val();
				where['endTime']   = $('#endTime').val();
				return where;
			},
			
			widthType : 'tdw', //thw-标题标准宽度、tdw-数据单元标准宽度、auto-随数据单元宽度
			pageNum : 10,
			nowPage : 1,
			orderName : "addtime",
			orderDirection : "desc",
			dataContextMenuOpen: false, //是否开启数据行右键菜单
			dataContextMenu: function(){
				$.contextMenu({
					selector: '.et_tbody tr',
					items: {
						"edit": {
							name: "修改", 
							icon: "edit",
							callback: function(key, options) {
								var href   = "{:U('Product/drinkEdit')}&id="+$(this).attr('rowid');
								var width  = '800px';
								var height = '500px';
								var title  = '修改饮品';
								openDialog('Restaurant_edit',href,width,height,title);
							}
						},
					}
				});
			},
			colModel : [
				{
					display : 'checkbox',
					name : 'id',
					sortable : false,
					myclass : 'center',
					edit : false
				},
				{
					display : '城市',
					name : 'city',
					sortable : true,
					myclass : 'center',
					edit : true,
				},
				{
					display : '领取人',
					name : 'realname',
					sortable : true,
					myclass : 'center',
					edit : true,
				},
				{
					display : '商品编号',
					name : 'drink_num',
					sortable : true,
					myclass : 'center',
					edit : true,
				},
				{
					display : '商品名称',
					name : 'title',
					sortable : true,
					myclass : 'center',
					edit : true
				},
				{
					display : '领取数量',
					name : 'num',
					sortable : true,
					myclass : 'center',
					edit : true,
				},
				{
					display : '领取时间',
					name : 'addtime',
					sortable : true,
					myclass : 'center',
					edit : false,
				},
				{
					display : '备注',
					name : 'content',
					sortable : true,
					myclass : 'center',
					edit : false,
				}
			]
		};
	
	//实例化列表
	var tableList = $('.table_box').EtGrid(listConfig);
	//tableList.erefresh();
	
	//搜索
 	$('#doSearch').on('click',function(){
		
		var where = tableList.config.getWhere();
		tableList.config.nowPage = 1;
		tableList.config.where   = where;
		tableList.search();
	});
	
	//重置搜索条件
	$('#doRest').on('click',function(){
		$('#drinkid').val('');
		$('#userid').val('');
		$('#startTime').val('');
		$('#endTime').val('');
	});
	
	$('.exportBtn').on('click',function(){
		$('.searchForm').submit();
	})
</script>
</html>
